{extend name="common:frm_base" /}
{block name="content"}
<style>
    .layui-form-label{width:110px;padding:9px 0;}
    .layui-input-block{margin-left:125px;}
</style>
<div class="layui-fluid" id="contents">
    <div class="layui-card">
        <div class="layui-card-header">批量添加空存折</div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="{:url('Volunteer/handle')}" lay-filter="component-form-group">
                <div class="layui-form-item" style="position: relative;z-index:1000001;">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block" style="position:relative;z-index:100;">
                        <select name="type_id" lay-filter="aihao">
                            <option value="0">站点</option>
                            <option value="1">服务队</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" id="site" style="position: relative;z-index:1000000;">
                    <label class="layui-form-label">站点</label>
                    <div class="layui-input-block" style="position:relative;z-index:100;">
                        <select lay-search="" name="site_id" style="width:300px;">
                            <option value="">请选择站点</option>
                            {volist name="site" id="val"}
                            <option value="{$val.id}">{$val.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide" id="site_team" style="position: relative;z-index:100000;">
                    <label class="layui-form-label">服务队</label>
                    <div class="layui-input-block" style="position:relative;z-index:100;">
                        <select lay-search="" name="oid" style="width:300px;">
                            <option value="">请选择服务队</option>
                            {volist name="site_team" id="val"}
                            <option value="{$val.id}">{$val.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">数量</label>
                    <div class="layui-input-block" style="position:relative;z-index:100;">
                        <input type="text" lay-verify="required" name="number" placeholder="请输入数量,批量生成数量最多为200" class="layui-input" />
                    </div>
                </div>
                <input type="hidden" value="batch" name="act" />
                <div class="layui-form-item layui-hide">
                    <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
                </div>
                <!--<div class="layui-form-item layui-layout-admin">-->
                <!--<div class="layui-input-block">-->
                <!--<div class="layui-footer" style="left: 0;">-->
                <!--<button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">立即提交</button>-->
                <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
            </form>
        </div>
    </div>
</div>
<!-- 配置文件 -->
<script type="text/javascript" src="__COMMON__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__COMMON__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        initialFrameHeight : 500
    });
</script>
<script>
    layui.config({
        base: '__LAYUIADMIN__/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'upload'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form
            ,upload = layui.upload;
        form.on('select(aihao)', function(data){
            if(data.value==1){
                $('#site').addClass('layui-hide');
                $('#site_team').removeClass('layui-hide');
            }else{
                $('#site_team').addClass('layui-hide');
                $('#site').removeClass('layui-hide');
            }
        });

        form.render(null, 'component-form-group');

        laydate.render({
            type: 'datetime',
            elem: '#retreat_time' //指定元素
        });
        laydate.render({
            type: 'datetime',
            elem: '#sign_time' //指定元素
        });
        laydate.render({
            type: 'datetime',
            elem: '#activity_use_time' //指定元素
        });
        laydate.render({
            type: 'datetime',
            elem: '#activity_end_time' //指定元素
        });


        var uploadInst = upload.render({
            elem: '#bus_img_btn'
            , url: "{:url('common/upload_img')}"
            , data: {name:'article'}
            , accept: 'images'
            , acceptMime: 'image/*,image/gif'
            , done: function (res) {
                $('#bus_img_btn').attr('src',res.data.img);
                $('#thumb').val(res.data.img);
            }
            , error: function () {
            }
        });

        $('#pic-list').viewer();

        $(".demo-reload").click(function () {
            $(this).parents('.layui-col-xs3').remove();//模拟前端删除按钮
            var img_urls = [];
            $(".layui-upload-img").each(function () {
                img_urls.push($(this).attr("data-src"));
            });
            $("#img_url").val(img_urls);
        });

        form.render(null, 'component-form-group');

        layer.photos({
            photos: '#contents'
        });

    });
</script>
{/block}